package com.sample.openalpr;
import com.sample.openalpr.slice.MainAbilitySlice;
import ohos.aafwk.ability.Ability;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Component;
import ohos.agp.components.Image;
import ohos.app.Context;
import ohos.security.SystemPermission;

import java.io.File;
import java.util.List;


import static ohos.bundle.IBundleManager.PERMISSION_GRANTED;
public class MainAbility extends Ability {


    private final int REQUEST_IMAGE = 100;
    private final int REQUEST_FILE = 42;
    private Context appCtx;
    private File imageFile;
    private String ANDROID_DATA_DIR;
    private Image imageView;
    private Component component;

    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        String[] permission = {"ohos.permission.INTERNET", "ohos.permission.WRITE_EXTERNAL_STORAGE",
                "ohos.permission.READ_EXTERNAL_STORAGE","ohos.permission.READ_MEDIA","ohos.permission.WRITE_MEDIA",  "ohos.permission.READ_USER_STORAGE", "ohos.permission.WRITE_USER_STORAGE", SystemPermission.CAMERA, SystemPermission.MICROPHONE};
        for (int i=0;i<permission.length;i++){
            if(verifyCallingOrSelfPermission(permission[i]) != 0){
                if(canRequestPermission(permission[i])){
                    requestPermissionsFromUser(permission, 0);
                }
            }
        }
        super.setMainRoute(MainAbilitySlice.class.getName());
    }





}
